﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Escuela.Forms
{
    public partial class EgresoForm : Form
    {
        private Instituto inst;
        public EgresoForm(Instituto inst)
        {
            this.inst = inst;
            InitializeComponent();
        }


        private void btAceptar_Click(object sender, EventArgs e)
        {
            
            string observacion = textDescrip.Text.Trim();
            DateTime fecha = Convert.ToDateTime(dateTimePicker1.Text.Trim());
            if (!String.IsNullOrEmpty(maskedNroCur.Text.Trim()) && !String.IsNullOrEmpty(observacion))
            {
                decimal monto = (Convert.ToDecimal(maskedNroCur.Text.Trim()))*(-1);
                this.inst.registrarEgreso(monto, fecha, observacion);
                MessageBox.Show("Egreso registrado correctamente");
                this.limpiarTxt();
            }
            else
            {
                MessageBox.Show("Complete toda la informacion solicitada");
            }
        }

        private void btCancelar_Click(object sender, EventArgs e)
        {
            this.limpiarTxt();
            this.Close();
        }

        protected void limpiarTxt()
        {
            this.textDescrip.Clear();
            this.maskedNroCur.Clear();

        }

        private void EgresoForm_Load(object sender, EventArgs e)
        {

        }


    }
}
